function setCookie( name, value,expires, path, domain, secure ){
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	var expires_date = new Date( today.getTime() + (1000*expires) );

	var line = name + "=" +escape( value ) +
	   ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	   ( ( path ) ? ";path=" + path : "" ) +
	   ( ( domain ) ? ";domain=" + domain : "" ) +
	   ( ( secure ) ? ";secure" : "" );

	document.cookie = line;
 }
 
 
 function readNode(jsdom, id){
	try{
	   if(jsdom.getElementsByTagName(id)==null){return null}
	   var idNode = jsdom.getElementsByTagName(id)[0]
	   if(idNode==null){return null}
	   if(idNode.childNodes==null){return null}
	   if(idNode.childNodes.length==0){return null}
	   return (idNode.childNodes[0].nodeValue)
	}
	catch(e){return null}
 }
